#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <ctime>
using namespace std;

class Person{
public:
    Person(const string & name, int score)
    : _name(name)
    , _score(score)
    {}

    string _name;
    int _score;
};

// 创建选手
void createPerson(vector<Person>& vec){
    string nameseed = "ABCDE";
    for (int i=0; i<5; i++){
        string name = "Player";
        name += nameseed[i];

        vec.push_back(Person(name, 0));
    }
}

void printScore(vector<Person> vec){
    for (int i=0; i<vec.size(); i++){
        cout << vec[i]._name << "'s score is " << vec[i]._score << endl;
    }
}

void setScore(vector<Person> &vec){
    for (auto it = vec.begin(); it != vec.end(); it++){
        deque<int> dq;
        for (int i=0; i<10; i++){
            int score = rand() % 41 + 60;
            dq.push_back(score);
        }
        sort(dq.begin(), dq.end());
        dq.pop_back();
        dq.pop_front();
        int sum = 0;
        for (int i=0; i< dq.size(); i++){
            sum += dq[i];
        }
        int avg = sum / dq.size();
        (*it)._score = avg;
    }
}

int main(){
    srand(time(NULL));
    vector<Person> vec;
    createPerson(vec);
    setScore(vec);
    printScore(vec);

    return 0;
}